home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 January / Disc 3 / Amethyst.iso / live / usr / share / vim / vim60 / vimrc_example.vim < prev   
Encoding:
Text File  |  2002-06-19  |  2.5 KB  |  79 lines

  1. " An example for a vimrc file.
  2. "
  3. " Maintainer:    Bram Moolenaar <Bram@vim.org>
  4. " Last change:    2001 Jul 18
  5. "
  6. " To use it, copy it to
  7. "     for Unix and OS/2:  ~/.vimrc
  8. "          for Amiga:  s:.vimrc
  9. "  for MS-DOS and Win32:  $VIM\_vimrc
  10. "        for OpenVMS:  sys$login:.vimrc
  11.  
  12. " When started as "evim", evim.vim will already have done these settings.
  13. if v:progname =~? "evim"
  14.   finish
  15. endif
  16.  
  17. " Use Vim settings, rather then Vi settings (much better!).
  18. " This must be first, because it changes other options as a side effect.
  19. set nocompatible
  20.  
  21. " allow backspacing over everything in insert mode
  22. set backspace=indent,eol,start
  23.  
  24. set autoindent        " always set autoindenting on
  25. set showmatch        " jump emacs style to matching bracket
  26. set incsearch        " highlight match while typing search pattern
  27.  
  28. if has("vms")
  29.   set nobackup        " do not keep a backup file, use versions instead
  30. else
  31.   " set backup        " keep a backup file
  32. endif
  33. set history=50        " keep 50 lines of command line history
  34. set ruler        " show the cursor position all the time
  35. set showcmd        " display incomplete commands
  36. set incsearch        " do incremental searching
  37.  
  38. " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
  39. " let &guioptions = substitute(&guioptions, "t", "", "g")
  40.  
  41. " Don't use Ex mode, use Q for formatting
  42. map Q gq
  43.  
  44. " Make p in Visual mode replace the selected text with the "" register.
  45. vnoremap p <Esc>:let current_reg = @"<CR>gvs<C-R>=current_reg<CR><Esc>
  46.  
  47. " This is an alternative that also works in block mode, but the deleted
  48. " text is lost and it only works for putting the current register.
  49. "vnoremap p "_dp
  50.  
  51. " Switch syntax highlighting on, when the terminal has colors
  52. " Also switch on highlighting the last used search pattern.
  53. if &t_Co > 2 || has("gui_running")
  54.   syntax on
  55.   set hlsearch
  56. endif
  57.  
  58. " Only do this part when compiled with support for autocommands.
  59. if has("autocmd")
  60.  
  61.   " Enable file type detection.
  62.   " Use the default filetype settings, so that mail gets 'tw' set to 72,
  63.   " 'cindent' is on in C files, etc.
  64.   " Also load indent files, to automatically do language-dependent indenting.
  65.   filetype plugin indent on
  66.  
  67.   " For all text files set 'textwidth' to 78 characters.
  68.   autocmd FileType text setlocal textwidth=78
  69.  
  70.   " When editing a file, always jump to the last known cursor position.
  71.   " Don't do it when the position is invalid or when inside an event handler
  72.   " (happens when dropping a file on gvim).
  73.   autocmd BufReadPost *
  74.     \ if line("'\"") > 0 && line("'\"") <= line("$") |
  75.     \   exe "normal g`\"" |
  76.     \ endif
  77.  
  78. endif " has("autocmd")
  79.